var express = require('express');
var Query = require('../utlis/db');

var router = express.Router();


/* GET home page. */
router.get('/', function (req, res, next) {
    res.render('index', { title: 'Express' });
});
router.get('/banners', async function (req, res, next) {
    let [err, result] = await Query(`SELECT concat("http://localhost:3000/uploads/",image_src) AS image_src ,title FROM e_banners `)
    if (err) {
        next("出错了")
        return
    }
    res.send({
        code: 200,
        msg: "banners请求成功",
        result
    })
    console.log(result);
})
module.exports = router;
